package com.example.demo.mapper;

import com.example.demo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper // 关键注解
public interface UserRepository {

    @Insert("INSERT INTO users (username, password) VALUES (#{username}, #{password})")
    void save(User user);

    @Select("SELECT * FROM users WHERE username = #{username}")
    User findByUsername(String username);
}
